package com.mairuide.exceltitle_dict.enum2;

import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * Created by 敲代码的卡卡罗特
 * on 2019/1/10 14:56.
 */
public enum FieldTypeEnum {
    STRING("字符串类型",String.class),
    INTEGER("int类型",Integer.class),
    BIGDECIMAL("浮点数类型",BigDecimal.class),
    TIMESTAMP("时间类型",Timestamp.class);
    private String desc; //描述
    private Class clazz;//对应的class
    private Integer val;//对应的值

    FieldTypeEnum(String desc, Class clazz) {
        this.desc = desc;
        this.clazz = clazz;
    }

    public static Class getFieldTypeEnumByVal(Integer val){
        Class clazz=null;
        if(val==1){
            clazz=String.class;
        }else if(val==2){
            clazz=Integer.class;
        }else if(val==3){
            clazz=BigDecimal.class;
        }else if(val==4){
            clazz=Timestamp.class;
        }
        return clazz;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Class getClazz() {
        return clazz;
    }

    public void setClazz(Class clazz) {
        this.clazz = clazz;
    }

    public Integer getVal() {
        return val;
    }

    public void setVal(Integer val) {
        this.val = val;
    }
}
